﻿CREATE PROCEDURE [Cucina].[SP_Vassoio_DA]
	@ComandaID int
AS
	-- CANCELLA IL VASSOIO
	DELETE FROM Cucina.VassoioConsegna
	WHERE VassoioID IN
	(
		SELECT VassoioID
		FROM Cucina.Vassoio
		WHERE ComandaID = @ComandaID
	)

	DELETE FROM Cucina.ProdottiOrdinatiVassoio
	WHERE VassoioID IN
	(
		SELECT VassoioID
		FROM Cucina.Vassoio
		WHERE ComandaID = @ComandaID
	)

	DELETE FROM Cucina.VassoioStampaRemota
	WHERE VassoioID IN
	(
		SELECT VassoioID
		FROM Cucina.Vassoio
		WHERE ComandaID = @ComandaID
	)

	DELETE FROM Cucina.Vassoio
	WHERE ComandaID = @ComandaID
RETURN 0